最近打算幫 apk 簽名,想說應該是該準備 keystore 給它。
試了一陣子,還是沒辦法順利簽名。
經過一番折騰, google 到 可以透過 IDE 產生。


接者把新的 keystore(這邊我命名為YumeBusKey.jks
) 放到 project 內。

接著,如果不想把密碼寫死在 build.gradle
,可以準備一個 local.properties
並且小心不把它加到版本管控。
local.properties1 2
| KEYSTORE_PASSWORD=1234 KEY_PASSWORD=1234
|
app/build.gradle1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| android {
signingConfigs { releaseSign { Properties props = new Properties() props.load(new FileInputStream("local.properties")) storeFile file('YumeBusKey.jks') keyAlias 'YumeKey' keyPassword props.getProperty("KEY_PASSWORD") storePassword props.getProperty("KEYSTORE_PASSWORD") } }
buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.releaseSign } }
}
|